package com.itheima.mapper;

import com.itheima.pojo.Emp;
import com.itheima.pojo.LimitConditons;
import com.itheima.pojo.Login;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;

@Mapper
public interface EmpMapper {
    @Select("select count(*) from emp")
    Integer findCount();


    List<Emp> findPage(LimitConditons limitConditons);

    void deleteByIds(List<Integer> ids);

    @Insert("insert into emp values(#{id},#{username},#{password},#{name},#{gender},#{image},#{job},#{entrydate},#{deptId},#{createTime},#{updateTime}) ")
    void add(Emp emp);

    @Select("select * from emp where id=#{id}")
    Emp findById(Integer id);

    void updateById(Emp emp);

    @Select("select * from emp where username=#{username} and password=#{password}")
    Emp login(Emp emp);

    @Delete("delete from emp where dept_id=#{deptId}")
    void deleteByDeptId(Integer deptId);
}
